﻿using System.Collections.Generic;
using DIBestPractice.Application.Log;
using DIBestPractice.ApplicationService;
using DIBestPractice.Domain;

namespace DIBestPractice.Application
{
    public class UserManager
    {
        private readonly IUserApplicationService _userApplicationService;
        private readonly ILogger _logger;

        public UserManager(IUserApplicationService userApplicationService,ILogger logger)
        {
            _userApplicationService = userApplicationService;
            _logger = logger;
        }

        public void RegisterUser(string name, string email, int age)
        {
            var user = new User(name, email, age);

            _userApplicationService.Register(user);
            _logger.Log("register user:" + name);
        }

        public List<User> GetAllUsers()
        {
            return _userApplicationService.GetAllUsers();
        }
    }
}